namespace Brjnk.GpxExplorer.WPF
{
    using System;
    using System.Windows.Data;
    using System.Windows.Media;

    /// <summary>
    /// </summary>
    public class ColorToBrushConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            var color = (Color)value;
            return new SolidColorBrush(color);
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            var brush = value as SolidColorBrush;
            if (brush == null) return null;
            return brush.Color;
        }
    }
}